<!DOCTYPE html>
<html lang="zh">
<head>
  <th:block th:include="include :: header('基本表单')"/>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
  <div class="row">
    <div class="col-sm-12">
      <form class="form-horizontal" id="grid-datasrc-form">
        <div class="form-group">
          <label class="col-sm-3 control-label">连接名: </label>
          
          <div class="col-sm-8">
            <input type="text" name="connName" placeholder="连接名" class="form-control"/>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-3 control-label">数据库类型: </label>
          
          <div class="col-sm-8">
            <select name="dbType" placeholder="数据库类型" class="form-control"
                    th:with="item=${T(com.bizdk.generator.core.DbType).values()}">
              <option value="">请选择数据库类型</option>
              <option th:each="dbtype : ${item}" th:text="${dbtype}" th:value="${dbtype}"></option>
            </select>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-3 control-label">数据库URL: </label>
          
          <div class="col-sm-8">
            <input type="text" name="connUrl" placeholder="数据库URL" class="form-control"/>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-3 control-label">用户名: </label>
          
          <div class="col-sm-8">
            <input type="text" name="username" placeholder="用户名" class="form-control"/>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-3 control-label">密码: </label>
          
          <div class="col-sm-8">
            <input type="password" name="password" placeholder="密码" class="form-control"/>
          </div>
        </div>
      </form>
    </div>
  </div>
</div>
<th:block th:include="include :: footer"/>

<script type="text/javascript">
    var prefix = ctx + "gen/datasrc";

    function submitHandler() {
        var data = $("#grid-datasrc-form").serialize();
        $.ajax({
            cache : true,
            type : "POST",
            url : prefix + "/save",
            data : data,
            async : false,
            error : function(req) {
                $.modal.alertError("系统错误");
            },
            success : function(data) {
                $.operate.successCallback(data);
            }
        });
    }


</script>

</body>
</html>
